package br.com.rfq.view.company;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class CompanyServlet
 */
@WebServlet(name = "AddCompany", urlPatterns = { "/addCompany" })
public class CompanyServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@SuppressWarnings("unused")
	protected void doPost(HttpServletRequest request
					   , HttpServletResponse response) 
					throws ServletException, IOException {
		
		String company = request.getParameter("companyName");
		
		String address = request.getParameter("address");
		if ("".equals( company )) {
			System.out.println("XXXXX");
		}
		
		PrintWriter writer = response.getWriter();
		writer.println("<html>");
		writer.println("<body>");
		writer.println("<ul>");
		
		writer.println("<li>");
		writer.println(" Method "  + request.getMethod());
		writer.println("</li>");

		writer.println("<li>");
		writer.println(" ContentLength "  + request.getContentLength());
		writer.println("</li>");

		writer.println("<li>");
		writer.println(" ContentType "  + request.getContentType());
		writer.println("</li>");

		writer.println("<li>");
		writer.println(" ContextPath "  + request.getContextPath());
		writer.println("</li>");

		writer.println("<li>");
		writer.println(" LocalAddr "  + request.getLocalAddr());
		writer.println("</li>");
		
		writer.println("<li>");
		writer.println(" LocalPort "  + request.getLocalPort());
		writer.println("</li>");
		
		writer.println("<li>");
		writer.println(" PathInfo "  + request.getPathInfo());
		writer.println("</li>");
		
		writer.println("<li>");
		writer.println(" RemoteAddr "  + request.getRemoteAddr());
		writer.println("</li>");

		writer.println("<li>");
		writer.println(" RemoteHost "  + request.getRemoteHost());
		writer.println("</li>");
		
		
		writer.println("</ul>");
		
		writer.println("</body>");
		writer.println("</html>");
		
		
	}

}
